<html>
<head><meta charset="utf-8"><title>adapter / adaptor · t-libs · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/index.html">t-libs</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/adapter.20.2F.20adaptor.html">adapter / adaptor</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="247705993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/adapter%20/%20adaptor/near/247705993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Frank Steffahn <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/adapter.20.2F.20adaptor.html#247705993">(Jul 30 2021 at 13:15)</a>:</h4>
<p>Hi, I’m wondering which spelling, “adapter” or “adaptor”, is supposed to be used in the library docs. I’ve seen both e.g. on <a href="https://doc.rust-lang.org/nightly/std/iter/trait.Iterator.html">https://doc.rust-lang.org/nightly/std/iter/trait.Iterator.html</a> and I don’t like the inconsistency. Even though “adaptor” is more common on that page, throughout the whole <code>std</code>, “adapter” seems to win, including in the naming of internal modules such as <code>core::iter::adapters</code>.</p>
<p>Would it be reasonable to do a PR to make them all consistent and if yes which one to choose?</p>



<a name="247706004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/adapter%20/%20adaptor/near/247706004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Frank Steffahn <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/adapter.20.2F.20adaptor.html#247706004">(Jul 30 2021 at 13:15)</a>:</h4>
<hr>
<div class="codehilite"><pre><span></span><code> ~/forks/rust/library   master  rg &#39;adapter&#39;
core/tests/iter/mod.rs
7://! smaller modules. The two big modules are `adapters` and `traits`.
9://! `adapters` are for methods on `Iterator` that adapt the data inside the
15://! if a test in `traits` uses a specific adapter, then it should be moved to
16://! that adapter&#39;s test file in `adapters`.
18:mod adapters;

core/tests/iter/traits/double_ended.rs
7://! it tests another adapter or trait, you should *add it to the adapter or
10://! Some examples would be `adapters::cloned::test_cloned_try_folds` or
11://! `adapters::flat_map::test_double_ended_flat_map`, which use `try_fold` and
12://! `next_back`, but test their own adapter.

std/src/collections/mod.rs
239://! Iterators also provide a series of *adapter* methods for performing common
240://! threads to sequences. Among the adapters are functional favorites like `map`,
242://! `rev` adapter, that reverses any iterator that supports this operation. Most

core/src/ops/control_flow.rs
165:/// These are used only as part of implementing the iterator adapters.

std/src/io/buffered/mod.rs
57:    /// adapters that wrap other adapters

core/src/iter/adapters/scan.rs
2:use crate::iter::{adapters::SourceIter, InPlaceIterable};

core/src/iter/adapters/cloned.rs
1:use crate::iter::adapters::{

core/src/iter/adapters/filter.rs
2:use crate::iter::{adapters::SourceIter, FusedIterator, InPlaceIterable};

core/src/iter/adapters/map.rs
2:use crate::iter::adapters::{

core/src/iter/adapters/map_while.rs
2:use crate::iter::{adapters::SourceIter, InPlaceIterable};

core/src/iter/adapters/copied.rs
1:use crate::iter::adapters::{

core/src/iter/adapters/intersperse.rs
3:/// An iterator adapter that places a separator between all elements.
60:/// An iterator adapter that places a separator between all elements.

core/src/iter/adapters/take_while.rs
2:use crate::iter::{adapters::SourceIter, FusedIterator, InPlaceIterable};

core/src/iter/adapters/chain.rs
25:    // adapter because its specialization for `FusedIterator` unconditionally descends into the

core/src/iter/adapters/enumerate.rs
1:use crate::iter::adapters::{

core/src/iter/adapters/filter_map.rs
2:use crate::iter::{adapters::SourceIter, FusedIterator, InPlaceIterable};

core/src/iter/adapters/skip.rs
2:use crate::iter::{adapters::SourceIter, FusedIterator, InPlaceIterable};

core/src/iter/adapters/peekable.rs
1:use crate::iter::{adapters::SourceIter, FusedIterator, TrustedLen};

core/src/iter/adapters/inspect.rs
2:use crate::iter::{adapters::SourceIter, FusedIterator, InPlaceIterable};

core/src/iter/adapters/skip_while.rs
2:use crate::iter::{adapters::SourceIter, FusedIterator, InPlaceIterable};

core/src/iter/sources/repeat_with.rs
8:/// Infinite iterators like `repeat_with()` are often used with adapters like

core/src/iter/adapters/mod.rs
60:/// This trait provides transitive access to source-stage in an iterator-adapter pipeline
63:/// * there is a delegating implementation of this trait for each adapter in the pipeline between
71:/// source of a pipeline. A stateful intermediate adapter might eagerly evaluate a part
108:    /// This means iterator adapters can rely on the source not changing during
111:    /// Implementing this method means adapters relinquish private-only access to their
113:    /// The lack of restricted access also requires that adapters must uphold the source&#39;s
117:    /// its public API since adapters sitting between it and the source have the same
118:    /// access. In particular an adapter may have consumed more elements than strictly necessary.
128:/// An iterator adapter that produces output as long as the underlying

core/src/iter/sources/repeat.rs
7:/// Infinite iterators like `repeat()` are often used with adapters like

core/src/iter/adapters/take.rs
2:use crate::iter::{adapters::SourceIter, FusedIterator, InPlaceIterable, TrustedLen};

core/src/iter/adapters/fuse.rs
2:use crate::iter::adapters::zip::try_get_unchecked;

core/src/iter/mod.rs
53://! more complex forms of processing. See the [Adapters](#adapters) section
76://! each iterator and iterator adapter.
257://! often called &#39;iterator adapters&#39;, as they&#39;re a form of the &#39;adapter
260://! Common iterator adapters include [`map`], [`take`], and [`filter`].
263://! If an iterator adapter panics, the iterator will be in an unspecified (but
274://! Iterators (and iterator [adapters](#adapters)) are *lazy*. This means that
324://! It is common to use the [`take`] iterator adapter to turn an infinite
395:pub use self::adapters::zip;
397:pub use self::adapters::Cloned;
399:pub use self::adapters::Copied;
401:pub use self::adapters::Flatten;
403:pub use self::adapters::MapWhile;
405:pub use self::adapters::SourceIter;
407:pub use self::adapters::StepBy;
409:pub use self::adapters::TrustedRandomAccess;
411:pub use self::adapters::TrustedRandomAccessNoCoerce;
413:pub use self::adapters::{
418:pub use self::adapters::{Intersperse, IntersperseWith};
420:pub(crate) use self::adapters::process_results;
422:mod adapters;

core/src/iter/traits/iterator.rs
1343:    /// The [`map`] adapter is very useful, but only when the closure

core/src/iter/adapters/zip.rs
556:pub(in crate::iter::adapters) unsafe fn try_get_unchecked&lt;I&gt;(it: &amp;mut I, idx: usize) -&gt; I::Item

alloc/tests/vec.rs
994:fn test_from_iter_specialization_with_iterator_adapters() {

alloc/src/vec/source_iter_marker.rs
18:// on the adapter implementations (beyond `impl&lt;I: Trait&gt; Trait for Adapter&lt;I&gt;`) only depend on other
131:        // - it vectorizes better for some iterator adapters

stdarch/crates/stdarch-verify/arm-intrinsics.html
93182:        &lt;li&gt;&lt;a class=&quot;c-footer-section__link&quot; href=&quot;/products/software-development-tools/debug-probes-and-adapters&quot; title=&quot;Debug Probes and Adapters&quot;&gt;Debug Probes and Adapters&lt;/a&gt;&lt;/li&gt;
</code></pre></div>
<hr>
<div class="codehilite"><pre><span></span><code> ~/forks/rust/library   master  rg &#39;adaptor&#39;
core/tests/iter/adapters/mod.rs
27:/// `Iterator`&#39;s contract. Used to test that iterator adaptors don&#39;t

core/src/alloc/mod.rs
341:    /// Creates a &quot;by reference&quot; adaptor for this instance of `Allocator`.
343:    /// The returned adaptor also implements `Allocator` and will simply borrow this.

core/src/iter/traits/iterator.rs
697:    /// internal iteration on adaptors like `Chain`.
1296:    /// An iterator adaptor similar to [`fold`] that holds internal state and
1607:    /// This is useful to allow applying iterator adaptors while still

std/src/io/mod.rs
813:    /// Creates a &quot;by reference&quot; adaptor for this instance of `Read`.
815:    /// The returned adaptor also implements `Read` and will simply borrow this
892:    /// Creates an adaptor which will chain this stream with another.
930:    /// Creates an adaptor which will read at most `limit` bytes from it.
1329:/// * The [`flush`] method is useful for adaptors and explicit buffers
1680:    /// Creates a &quot;by reference&quot; adaptor for this instance of `Write`.
1682:    /// The returned adaptor also implements `Write` and will simply borrow this
2417:/// Reader adaptor which limits the bytes read from an underlying reader.
</code></pre></div>



<a name="247707867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/adapter%20/%20adaptor/near/247707867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Chris Denton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/adapter.20.2F.20adaptor.html#247707867">(Jul 30 2021 at 13:31)</a>:</h4>
<p>For what it's worth, "adapter" seems to be the much more common spelling in general. See <a href="https://github.com/first20hours/google-10000-english/blob/master/google-10000-english.txt">word list sorted by frequency</a>. There is apparently <a href="https://writingexplained.org/adapter-vs-adaptor-difference#Possible_Distinctions">some regional variation</a> in relative popularity but "adapter" seems to be winning everywhere.</p>



<a name="247720623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/adapter%20/%20adaptor/near/247720623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Frank Steffahn <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/adapter.20.2F.20adaptor.html#247720623">(Jul 30 2021 at 15:10)</a>:</h4>
<p>FWIW, the book uses “iterator adaptor”.</p>



<a name="247722692"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/adapter%20/%20adaptor/near/247722692" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Frank Steffahn <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/adapter.20.2F.20adaptor.html#247722692">(Jul 30 2021 at 15:24)</a>:</h4>
<p>Anyways, I’ve opened <a href="https://github.com/rust-lang/rust/issues/87629">#87629</a> for now.</p>



<a name="247882377"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/adapter%20/%20adaptor/near/247882377" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nick Cameron <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/adapter.20.2F.20adaptor.html#247882377">(Aug 01 2021 at 23:30)</a>:</h4>
<p>The GoF book uses "adapter" for the design pattern, which I would take as fairly authoritative (<a href="https://www.oreilly.com/library/view/design-patterns-elements/0201633612/">https://www.oreilly.com/library/view/design-patterns-elements/0201633612/</a>). I would personally use "adaptor", but I think that is due to higher prevalence in English English and since we use American English, I think "adapter" is better</p>



<a name="247882505"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/adapter%20/%20adaptor/near/247882505" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Pratt <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/adapter.20.2F.20adaptor.html#247882505">(Aug 01 2021 at 23:34)</a>:</h4>
<p>While American English is technically preferred, in reality usage is quite mixed from my experience.</p>



<a name="247882791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/adapter%20/%20adaptor/near/247882791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> The 8472 <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/adapter.20.2F.20adaptor.html#247882791">(Aug 01 2021 at 23:42)</a>:</h4>
<p>Does it even matter? Both are cromulent.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>